<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>首页 - 驴妈妈流立方</title>
		<meta name="description" content="overview &amp; stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		<script src="${rc.contextPath}/assets/js/jquery.2.1.1.min.js"></script>
		<script src="${rc.contextPath}/assets/js/bootstrap.min.js"></script>
		<script src="${rc.contextPath}/assets/js/jquery-ui.custom.min.js"></script>
		<script src="${rc.contextPath}/assets/js/jquery.ui.touch-punch.min.js"></script>
		<script src="${rc.contextPath}/assets/js/bootbox.min.js"></script>
		<script src="${rc.contextPath}/assets/js/jquery.gritter.min.js"></script>
		<script src="${rc.contextPath}/assets/js/spin.min.js"></script>
		<!-- ace scripts -->
		<script src="${rc.contextPath}/assets/js/ace-elements.min.js"></script>
		<script src="${rc.contextPath}/assets/js/ace.min.js"></script>
		<!-- validator scripts -->
		<script src="${rc.contextPath}/assets/js/bootstrapValidator.min.js"></script>
		<!-- user scripts -->
		<script src="${rc.contextPath}/assets/js/user/base.js"></script>
		<link rel="stylesheet" href="${rc.contextPath}/assets/css/bootstrap.min.css" />
		<link rel="stylesheet" href="${rc.contextPath}/assets/font-awesome/4.2.0/css/font-awesome.min.css" />
		<!-- page specific plugin styles -->
		<link rel="stylesheet" href="${rc.contextPath}/assets/css/jquery-ui.custom.min.css" />
		<link rel="stylesheet" href="${rc.contextPath}/assets/css/jquery.gritter.min.css" />
		<!-- text fonts -->
		<link rel="stylesheet" href="${rc.contextPath}/assets/fonts/fonts.googleapis.com.css" />
		<!-- BootstrapValidator -->
		<link rel="stylesheet" href="${rc.contextPath}/assets/css/bootstrapValidator.min.css" />
		<!-- ace styles -->
		<link rel="stylesheet" href="${rc.contextPath}/assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" />
		<!-- ace settings handler -->
		<script src="${rc.contextPath}/assets/js/ace-extra.min.js"></script>
		<link rel="stylesheet" href="${rc.contextPath}/assets/css/bsie-paginator.css" />

	</head>

	<body class="no-skin" style="background-color: #FFF;">
		<div class="page-content">
		<div class="tab-content">
			<div class="row">
				<div class="col-xs-12">
					<div class="widget-box">
						<div class="widget-header widget-header-small">
							<h5 class="widget-title lighter">筛选条件</h5>
						</div>
						<div class="widget-body" style="background-color: #EFF3F8;">
							<div class="widget-main">
								<form class="form-inline" id="searchForm" method="post" action="${rc.contextPath}/webStatistics/firstScreenTimeSearch">
									<input id="chooseTimeVO" type="hidden" name="chooseTimeVO" value="${H5pageMonitorVO.chooseTimeVO}">
									<div class="form-group">
										<label for="exampleInputName2">选择时段</label> 
										<input type="text" id="config-demo" name="config-demo" class="form-control time" value="${H5pageMonitorVO.chooseTimeVO}">
									</div>
									<div class="form-group">
										<label for="exampleInputName2">省份</label>
										<input type="text" id="province" class="form-control" name="province" value="${H5pageMonitorVO.province}" placeholder="请输入省份" size="10">
									</div>
									<div class="form-group">
										<label for="exampleInputName2">城市</label>
										<input type="text" id="city" class="form-control" name="city" value="${H5pageMonitorVO.city}" placeholder="请输入城市" size="10">
									</div>
									<div class="form-group">
										<label for="exampleInputName2">运行商</label> 
										<select data-placeholder="" class="chosen-select" tabindex="2" name="operators" id="operators" style="width:85px">
											<#list operatorsList as operators>
												<option value="${operators.value}" <#if H5pageMonitorVO.operators== operators.value>selected</#if>>${operators.showName}</option>
											</#list>
										</select>
									</div>
									<div class="form-group">
										<label for="exampleInputName2">网络类型</label> 
										<select data-placeholder="" class="chosen-select" tabindex="2" name="network_type" id="network_type" style="width:85px">
											<#list netWorkTypeList as network>
												<option value="${network.value}" <#if H5pageMonitorVO.network_type == network.value>selected</#if>>${network.showName}</option>
											</#list>
										</select>
									</div>
									<div class="form-group">
										<label for="exampleInputName2">时长大于</label>
										<input type="text" id="load_time" class="form-control" name="load_time" value="${H5pageMonitorVO.load_time}" placeholder="大于多少S" size="8">
									</div>
									<div class="form-group">
										<label for="exampleInputName2">版本渠道</label>
										<select data-placeholder="" class="chosen-select" tabindex="2" name="is_lv" id="is_lv" style="width:85px">
										 <#list isLvTypeList as isLv>
												<option value="${isLv.value}" <#if H5pageMonitorVO.is_lv == isLv.value>selected</#if>>${isLv.showName}</option>
										 </#list>
										</select>
									</div>
									
									<div class="form-group">
										<label for="exampleInputName2">URL</label>
										<input type="text" id="url" class="form-control" name="url" value="${H5pageMonitorVO.url}" placeholder="请输入查询 URL">
									</div>
									<!-- <div class="btn-group">
										<lable  class="btn btn-sm btn-link"> 
										   <input type="radio" id="page_type" name="page_type" value="1">精确
										</lable>
									</div> -->
									<div class="form-group">
									  	<button id="search" type="button" onclick="searchClick();" class="btn btn-pink btn-sm">
											<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
											Search
										</button>
									</div>
									<div class="form-group">
									  	<button id="export" type="button" class="btn btn-pink btn-sm">
											<span class="ace-icon fa icon-on-right bigger-110"></span>
											导出excel
										</button>
									</div>
								</form>
								<form action="${rc.contextPath}/webStatistics/exportSearch" id="exportForm" method="post" hidden="true">
									<input id="chooseTimeVOExport" type="hidden" name="chooseTimeVOExport" value="${H5pageMonitorVO.chooseTimeVO}">
									<input id="provinceExport" type="hidden" name="provinceExport" value="${H5pageMonitorVO.province}">
									<input id="cityExport" type="hidden" name="cityExport" value="${H5pageMonitorVO.city}">
									<input id="operatorsExport" type="hidden" name="operatorsExport" value="${H5pageMonitorVO.operators}">
									<input id="networkTypeExport" type="hidden" name="networkTypeExport" value="${H5pageMonitorVO.network_type}">
									<input id="loadTimeExport" type="hidden" name="loadTimeExport" value="${H5pageMonitorVO.load_time}">
									<input id="isLvExport" type="hidden" name="isLvExport" value="${H5pageMonitorVO.is_lv}">
									<input id="urlExport" type="hidden" name="urlExport" value="${H5pageMonitorVO.url}">
									<input id="pageTypeExport" type="hidden" name="pageTypeExport" value="${H5pageMonitorVO.page_type}">
									<button type="submit" hidden="true" id="exportExcel" class="btn btn-primary" ></button>
								</form>
							</div>
						</div>
					</div>
				</div>
			</div>
			
			<div class="row">
				<div class="col-xs-12">
					<div class="widget-box">
						<div class="row">
							<div class="col-xs-12">
								<div style="width: 100%; margin: 0 auto;">
									<table id="simple-table" class="table table-striped table-bordered table-hover" style="margin-bottom: 0px;border-bottom: 0px;">
										<thead>
											<tr>
												<th>序号</th>
												<th>省份</th>
												<th>城市</th>
												<th>运营商</th>
												<th>网络制式</th>
												<th>加载时长</th>
												<th>是否H5访问</th>
												<th>URL</th>
											</tr>
										</thead>
										<tbody>
											<#if h5pageMonitorList?? && h5pageMonitorList?size&gt;0>
												<#list h5pageMonitorList as h5pageMonitor>
													<tr class="">
														<td>${h5pageMonitor_index + 1}</td>
														<td>${h5pageMonitor.province}</td>
														<td>${h5pageMonitor.city!}</td>
														<!-- <td><#if '${h5pageMonitor.operators!}' == 'CM'>移动
												            <#elseif '${h5pageMonitor.operators!}' == 'CU'>联通
												            <#elseif '${h5pageMonitor.operators!}' == 'CT'>电信
													        <#else>NONE
													        </#if>
													    </td> -->
													    <td>${h5pageMonitor.operators!}
													    </td>
														<td>${h5pageMonitor.network_type}</td>
														<td>${h5pageMonitor.load_time} S</td>
														<!-- <td><#if '${h5pageMonitor.is_lv!}' == '0'>H5
												            <#elseif '${h5pageMonitor.is_lv!}' == '1'>IOS
													        <#else>ANDROID
													        </#if>
													    </td> -->
													    <td>${h5pageMonitor.is_lv!}
													    </td>
													    <td>${h5pageMonitor.url}</td>
													</tr>
												</#list>
											<#else>
												<tr>
													<td colspan="12">
														<div class="alert alert-danger" style="margin-bottom: 0px;" role="alert">没有记录!</div>
													</td>
												</tr>
											</#if>
										</tbody>
									</table>
									<#include "paginator.html">
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			
		</div>

		<script src="${rc.contextPath}/assets/js/moment.min.js"></script>
		<script src="${rc.contextPath}/assets/js/bootstrap-datetimepicker.min.js"></script>
		
		<!-- <link rel="stylesheet" href="${rc.contextPath}/stylesheets/bootstrap.min.css"> -->
		<!-- <link rel="stylesheet" href="${rc.contextPath}/stylesheets/bootstrap-theme.min.css"> -->
		<link rel="stylesheet" href="${rc.contextPath}/stylesheets/daterangepicker.css">
		<script type="text/javascript" src="${rc.contextPath}/javascripts/jquery.2.1.1.min.js"></script>
	   	<script type="text/javascript" src="${rc.contextPath}/javascripts/bootstrap.min.js"></script>
	   	<script type="text/javascript" src="${rc.contextPath}/javascripts/moment.js"></script>
	   	<script type="text/javascript" src="${rc.contextPath}/javascripts/daterangepicker.js"></script>
	   	
	   	<script type="text/javascript" src="${rc.contextPath}/javascripts/echarts.js"></script>
	   	<script type="text/javascript" src="${rc.contextPath}/javascripts/china.js"></script>
	   	<script src="${rc.contextPath}/assets/js/jquery.gritter.min.js"></script>
		<script type="text/javascript">
		function replaceDate(obj){
    		if(obj == '1'){
    			startDate = new Date(new Date().getTime()-7*1000*60*60*24);
	    		endDate = new Date(new Date().getTime()-1*1000*60*60*24);
    		}else if(obj == '2'){
    			startDate = new Date(new Date().getTime()-14*1000*60*60*24);
	    		endDate = new Date(new Date().getTime()-1*1000*60*60*24);
    		}
		 	var dateStr = dateFormat(startDate) + " - " + dateFormat(endDate);
		    $("#chooseTimeVO").val(dateStr);
		    $(".time").val(dateStr);
    	}
		
			function dateFormat(date){
	    		var month = date.getMonth() + 1;
    		    var strDate = date.getDate();
    		    if (month >= 1 && month <= 9) {
    		        month = "0" + month;
    		    }
    		    if (strDate >= 0 && strDate <= 9) {
    		        strDate = "0" + strDate;
    		    }
    		    var currentdate = month + "/" + strDate + "/" + date.getFullYear();
    		    return currentdate;
	    	}

			function searchClick() {
				var chooseTime = $("#config-demo").val();
				$('#chooseTimeVO').val(chooseTime);
				
				var province = $("#province").val();
				$('#province').val(province);
				
				var city = $("#city").val();
				$('city').val(city);
				
			 	var load_time = $("#load_time").val();
				$('load_time').val(load_time);
				
				var is_lv = $("is_lv").val();
				$('is_lv').val(is_lv);
				
				var url = $("url").val();
				$('url').val(url);
				
				var page_type = $("page_type").val();
				$('page_type').val(page_type);
				
				var operators = $("operators").val();
				$('operators').val(operators);
				
				var network_type = $("network_type").val();
				$('network_type').val(network_type);
				
				$("#searchForm").submit();
			}
		
			jQuery(function($) {
				$('.time').daterangepicker(
						{
							startDate: new Date(new Date().getTime()-1*1000*60*60*24),
						    endDate: new Date(new Date().getTime()-1*1000*60*60*24),
							showDropdowns : true,
							showWeekNumbers : false,
							timePicker : false,
							timePicker12Hour : false,
							ranges : {
								'昨日': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
				            	'过去7天': [moment().subtract(7, 'days'), moment().subtract(1, 'days')],  
				                '过去31天': [moment().subtract(31, 'days'), moment().subtract(1, 'days')]
							},
							opens : 'right',
							buttonClasses : [ 'btn btn-default' ],
							applyClass : 'btn-small btn-pink blue',
							cancelClass : 'btn-small',
							format : 'yyyy-MM-dd',
							separator : ' to ',
							locale : {
								applyLabel : '确定',
								cancelLabel : '取消',
								fromLabel : '起始时间',
								toLabel : '结束时间',
								customRangeLabel : '自定义',
								daysOfWeek : [ '日', '一', '二', '三', '四', '五',
										'六' ],
								monthNames : [ '一月', '二月', '三月', '四月', '五月', 
										'六月', '七月', '八月', '九月', '十月', '十一月',
										'十二月' ],
								firstDay : 1
							}
						},
						function(start, end, label) {//格式化日期显示框  

							$('.time').html(
									start.format('yyyy-MM-dd') + ' - '
											+ end.format('yyyy-MM-dd'));
						});
				
				var chooseTimeVO = "${H5pageMonitorVO.chooseTimeVO}";
				if(chooseTimeVO != ""){
					$('#config-demo').val(chooseTimeVO);
				}
				
				/* 数值每3位，逗号隔开 */
				function formatNum(strNum) {
					if (strNum.length <= 3) {
						return strNum;
					}
					if (!/^(\+|-)?(\d+)(\.\d+)?$/.test(strNum)) {
						return strNum;
					}
					var a = RegExp.$1, b = RegExp.$2, c = RegExp.$3;
					var re = new RegExp();
					re.compile("(\\d)(\\d{3})(,|$)");
					while (re.test(b)) {
						b = b.replace(re, "$1,$2$3");
					}
					return a + "" + b + "" + c;
				}
				
			})
			
			
	         $("#export").on("click",function(){
					var time=$("#chooseTimeVO").val();
					$("#chooseTimeVOExport").val(time);
					
					var provinceExport = $("#provinceExport").val();
					$("#provinceExport").val(provinceExport);
					
					var cityExport = $("#cityExport").val();
					$("cityExport").val(cityExport);
					
					var operatorsExport = $("#operatorsExport").val();
					$("operatorsExport").val(operatorsExport);
					
					var networkTypeExport = $("#networkTypeExport").val();
					$("networkTypeExport").val(networkTypeExport);
					
					var loadTimeExport = $("#loadTimeExport").val();
					$("loadTimeExport").val(loadTimeExport);
					
					var isLvExport = $("#isLvExport").val();
					$("isLvExport").val(isLvExport);
					
					var urlExport = $("#urlExport").val();
					$("urlExport").val(urlExport);
					
					var pageTypeExport = $("pageTypeExport").val();
					$('pageTypeExport').val(pageTypeExport);
					
					$("#exportExcel").click();
				}); 
		/* 	
		$("#export").on("click",function(){
				window.open("${rc.contextPath}/webStatistics/exportSearch?province="+province);
				
			});  */
			
			
		</script>


		<link rel="stylesheet" href="${rc.contextPath}/assets/css/bootstrap.css" /> 
		<script src="${rc.contextPath}/assets/js/chosen.jquery.js"></script>
		
		<script>
			 $(function() {
		        $('.chosen-select').chosen();
		       	$('.chosen-select-deselect').chosen({ allow_single_deselect: true });
		     }); 
	      	
			 function statistics(){
				$('#statistics').show();
				$('.chosen-select').chosen("destroy").chosen();
		       	$('.chosen-select-deselect').chosen({ allow_single_deselect: true });
			 }
	    </script>
	    
	</body>
</html>